package cn.jorian.framework.util;

import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;

/**
 * Md5工具类
 */
public class MD5Util {

    /**
     * Md5摘要
     * @param str
     * @return
     */
    public static String md5Hex(String str) {
        byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
        String result = DigestUtils.md5DigestAsHex(bytes);
        return result.toUpperCase();
    }
}
